<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/apps/mqtt/mqtt.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('mqtt_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">mqtt.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="mqtt_8h.html">lwip/apps/mqtt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mqtt__priv_8h.html">lwip/apps/mqtt_priv.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="timeouts_8h.html">lwip/timeouts.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip__addr_8h.html">lwip/ip_addr.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mem_8h.html">lwip/mem.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="err_8h.html">lwip/err.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="pbuf_8h.html">lwip/pbuf.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="altcp_8h.html">lwip/altcp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="altcp__tcp_8h.html">lwip/altcp_tcp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="altcp__tls_8h.html">lwip/altcp_tls.h</a>&quot;</code><br />
<code>#include &lt;string.h&gt;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a99c325e06cc17ee24e09dab251606f9d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#a99c325e06cc17ee24e09dab251606f9d">MQTT_DEBUG</a>&#160;&#160;&#160;<a class="el" href="group__debugging__levels.html#gadab1cdc3f45939a3a5c9a3d7e04987e1">LWIP_DBG_OFF</a></td></tr>
<tr class="separator:a99c325e06cc17ee24e09dab251606f9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45c57ebd31832f1c128d847067c4688b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#a45c57ebd31832f1c128d847067c4688b">MQTT_CTL_PACKET_TYPE</a>(fixed_hdr_byte0)&#160;&#160;&#160;((fixed_hdr_byte0 &amp; 0xf0) &gt;&gt; 4)</td></tr>
<tr class="separator:a45c57ebd31832f1c128d847067c4688b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afba101fbf26b556c869060d3d013c8fa"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#afba101fbf26b556c869060d3d013c8fa">mqtt_ringbuf_free</a>(rb)&#160;&#160;&#160;(<a class="el" href="group__mqtt__opts.html#ga70627bafaffa071875cee9edc38d942b">MQTT_OUTPUT_RINGBUF_SIZE</a> - mqtt_ringbuf_len(rb))</td></tr>
<tr class="separator:afba101fbf26b556c869060d3d013c8fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad82b4039213ab3f1d9e4bcd3aa0c88a3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#ad82b4039213ab3f1d9e4bcd3aa0c88a3">mqtt_ringbuf_linear_read_length</a>(rb)&#160;&#160;&#160;LWIP_MIN(mqtt_ringbuf_len(rb), (<a class="el" href="group__mqtt__opts.html#ga70627bafaffa071875cee9edc38d942b">MQTT_OUTPUT_RINGBUF_SIZE</a> - (rb)-&gt;get))</td></tr>
<tr class="separator:ad82b4039213ab3f1d9e4bcd3aa0c88a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:a06fc87d81c62e9abb8790b6e5713c55b"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"></td></tr>
<tr class="separator:a06fc87d81c62e9abb8790b6e5713c55b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac243cf15beb51b2206e36da86c2f95f1"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#ac243cf15beb51b2206e36da86c2f95f1">mqtt_message_type</a> </td></tr>
<tr class="separator:ac243cf15beb51b2206e36da86c2f95f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f6c42ed730546ff755e3bb99989dd12"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mqtt_8c.html#a4f6c42ed730546ff755e3bb99989dd12">mqtt_connect_flag</a> </td></tr>
<tr class="separator:a4f6c42ed730546ff755e3bb99989dd12"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gade9850d716e81fde572cb012be795d2f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gade9850d716e81fde572cb012be795d2f">mqtt_publish</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain, <a class="el" href="group__mqtt.html#gacad2bbe2cee76eaa120cc63e2f6094fd">mqtt_request_cb_t</a> cb, void *arg)</td></tr>
<tr class="separator:gade9850d716e81fde572cb012be795d2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafdb39d4a9758f98c02451aaa9a9b3103"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gafdb39d4a9758f98c02451aaa9a9b3103">mqtt_sub_unsub</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client, const char *topic, u8_t qos, <a class="el" href="group__mqtt.html#gacad2bbe2cee76eaa120cc63e2f6094fd">mqtt_request_cb_t</a> cb, void *arg, u8_t sub)</td></tr>
<tr class="separator:gafdb39d4a9758f98c02451aaa9a9b3103"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafdfa0e65b217e92835d35858924565cf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gafdfa0e65b217e92835d35858924565cf">mqtt_set_inpub_callback</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client, <a class="el" href="group__mqtt.html#ga7116bb85255394cec4b1d9fa38842c29">mqtt_incoming_publish_cb_t</a> pub_cb, <a class="el" href="group__mqtt.html#gafec7e75fe6a746eef9ca411463446c81">mqtt_incoming_data_cb_t</a> data_cb, void *arg)</td></tr>
<tr class="separator:gafdfa0e65b217e92835d35858924565cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae7e19e236eb6122c8c39e93db6f5f53f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gae7e19e236eb6122c8c39e93db6f5f53f">mqtt_client_new</a> (void)</td></tr>
<tr class="separator:gae7e19e236eb6122c8c39e93db6f5f53f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa0fa1d985c322a9c91a51322db254882"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gaa0fa1d985c322a9c91a51322db254882">mqtt_client_free</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client)</td></tr>
<tr class="separator:gaa0fa1d985c322a9c91a51322db254882"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadf4d2a3f1b12fb6cbc020b126f3125f0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#gadf4d2a3f1b12fb6cbc020b126f3125f0">mqtt_client_connect</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *<a class="el" href="structip__addr.html">ip_addr</a>, u16_t port, <a class="el" href="group__mqtt.html#ga8558743bdb7d599a93844fbc56c9029f">mqtt_connection_cb_t</a> cb, void *arg, const struct <a class="el" href="structmqtt__connect__client__info__t.html">mqtt_connect_client_info_t</a> *client_info)</td></tr>
<tr class="separator:gadf4d2a3f1b12fb6cbc020b126f3125f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga73d8dd718bce09bfaab452770b4f76e6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#ga73d8dd718bce09bfaab452770b4f76e6">mqtt_disconnect</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client)</td></tr>
<tr class="separator:ga73d8dd718bce09bfaab452770b4f76e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga98f0fd168112b8b7db59bcd7a325a5c5"><td class="memItemLeft" align="right" valign="top">u8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mqtt.html#ga98f0fd168112b8b7db59bcd7a325a5c5">mqtt_client_is_connected</a> (<a class="el" href="structmqtt__client__s.html">mqtt_client_t</a> *client)</td></tr>
<tr class="separator:ga98f0fd168112b8b7db59bcd7a325a5c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>MQTT client </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a45c57ebd31832f1c128d847067c4688b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a45c57ebd31832f1c128d847067c4688b">&#9670;&nbsp;</a></span>MQTT_CTL_PACKET_TYPE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MQTT_CTL_PACKET_TYPE</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">fixed_hdr_byte0</td><td>)</td>
          <td>&#160;&#160;&#160;((fixed_hdr_byte0 &amp; 0xf0) &gt;&gt; 4)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Helpers to extract control packet type and qos from first byte in fixed header </p>

</div>
</div>
<a id="a99c325e06cc17ee24e09dab251606f9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99c325e06cc17ee24e09dab251606f9d">&#9670;&nbsp;</a></span>MQTT_DEBUG</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MQTT_DEBUG&#160;&#160;&#160;<a class="el" href="group__debugging__levels.html#gadab1cdc3f45939a3a5c9a3d7e04987e1">LWIP_DBG_OFF</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>MQTT_DEBUG: Default is off. </p>

</div>
</div>
<a id="afba101fbf26b556c869060d3d013c8fa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afba101fbf26b556c869060d3d013c8fa">&#9670;&nbsp;</a></span>mqtt_ringbuf_free</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define mqtt_ringbuf_free</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">rb</td><td>)</td>
          <td>&#160;&#160;&#160;(<a class="el" href="group__mqtt__opts.html#ga70627bafaffa071875cee9edc38d942b">MQTT_OUTPUT_RINGBUF_SIZE</a> - mqtt_ringbuf_len(rb))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Return number of bytes free in ring buffer </p>

</div>
</div>
<a id="ad82b4039213ab3f1d9e4bcd3aa0c88a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad82b4039213ab3f1d9e4bcd3aa0c88a3">&#9670;&nbsp;</a></span>mqtt_ringbuf_linear_read_length</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define mqtt_ringbuf_linear_read_length</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">rb</td><td>)</td>
          <td>&#160;&#160;&#160;LWIP_MIN(mqtt_ringbuf_len(rb), (<a class="el" href="group__mqtt__opts.html#ga70627bafaffa071875cee9edc38d942b">MQTT_OUTPUT_RINGBUF_SIZE</a> - (rb)-&gt;get))</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Return number of bytes possible to read without wrapping around </p>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="a06fc87d81c62e9abb8790b6e5713c55b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a06fc87d81c62e9abb8790b6e5713c55b">&#9670;&nbsp;</a></span>anonymous enum</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>MQTT client connection states </p>

</div>
</div>
<a id="a4f6c42ed730546ff755e3bb99989dd12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f6c42ed730546ff755e3bb99989dd12">&#9670;&nbsp;</a></span>mqtt_connect_flag</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="mqtt_8c.html#a4f6c42ed730546ff755e3bb99989dd12">mqtt_connect_flag</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>MQTT connect flags, only used in CONNECT message </p>

</div>
</div>
<a id="ac243cf15beb51b2206e36da86c2f95f1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac243cf15beb51b2206e36da86c2f95f1">&#9670;&nbsp;</a></span>mqtt_message_type</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="mqtt_8c.html#ac243cf15beb51b2206e36da86c2f95f1">mqtt_message_type</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>MQTT control message types </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_53adf0b982dc8545998aae3f283a5a58.html">apps</a></li><li class="navelem"><a class="el" href="dir_dfacd4b005f6a743295cd1d76eff7420.html">mqtt</a></li><li class="navelem"><a class="el" href="mqtt_8c.html">mqtt.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
